package editer;

import js.html.Console;
import data.ZProjuectData.ZProjectData;
import haxe.ui.containers.VBox;

/**
 * 资源管理器
 */
@:build(haxe.ui.macros.ComponentMacros.build("assets/assets-manager-view.xml"))
class AssetsManagerView extends VBox {
	public var currentProjectData:ZProjectData;

	public function setProjectData(data:ZProjectData):Void {
		currentProjectData = data;
		Console.log(data.builderFiles);
		all_xml.dataSource.allowCallbacks = false;
		all_xml.dataSource.clear();
		for (index => value in data.builderFiles) {
			var name = value.name ?? "未命名" + index;
			if (name != null) {
				all_xml.dataSource.add({
					text: name,
					source: value
				});
			}
		}
		all_xml.dataSource.allowCallbacks = true;
	}
}
